#ifndef MQTT_CLIENT_H
#define MQTT_CLIENT_H

#include <Arduino.h>
#include <WiFi.h>
#include <ArduinoMqttClient.h>
#include <ArduinoJson.h>

// WiFi配置
extern const char* ssid;
extern const char* pass;

// MQTT配置
extern const char* broker;
extern int port;
extern const char* inTopic;
extern const char* outTopic;

// MQTT客户端对象
extern WiFiClient wifiClient;
extern MqttClient mqttClient;

// 函数声明
void setupWiFi();
void setupMQTT();
void mqttLoop();
void onMqttMessage(int messageSize);
void sendMQTTMessage(const String& message);
void sendCardStatus(const String& cardId, bool isRegistered);
void sendCommandResponse(const String& command, const String& result);
void sendCardList(const String& cardList, int count);
void processMQTTCommand(const String& command);

#endif
